(function(){
if(!window.XN){
XN={};
}
if(!XN.Browser){
XN.Browser=XN.BORWSER={};
}
XN.Browser.addHomePage=function(_1){
if(!!(window.attachEvent&&!window.opera)){
document.body.style.behavior="url(#default#homepage)";
document.body.setHomePage(_1);
}else{
if(window.clipboardData&&clipboardData.setData){
clipboardData.setData("text",_1);
}else{
alert("\u60a8\u7684\u6d4f\u89c8\u5668\u4e0d\u5141\u8bb8\u811a\u672c\u8bbf\u95ee\u526a\u5207\u677f\uff0c\u8bf7\u624b\u52a8\u8bbe\u7f6e~");
return;
}
alert("\u7f51\u5740\u5df2\u7ecf\u62f7\u8d1d\u5230\u526a\u5207\u677f,\u8bf7\u60a8\u6253\u5f00\u6d4f\u89c8\u5668\u7684\u9009\u9879,\n\u628a\u5730\u5740\u7c98\u5230\u4e3b\u9875\u9009\u9879\u4e2d\u5373\u53ef~");
}
return true;
};
XN.Browser.addBookMark=function(_2,_3){
var _4=(navigator.userAgent.toLowerCase()).indexOf("mac")!=-1?"Command/Cmd":"CTRL";
try{
window.external.addFavorite(_2,_3||""+XN.env.siteName+"-\u56e0\u4e3a\u771f\u5b9e,\u6240\u4ee5\u7cbe\u5f69");
}
catch(e){
try{
window.sidebar.addPanel(_2,_3||""+XN.env.siteName+"-\u56e0\u4e3a\u771f\u5b9e,\u6240\u4ee5\u7cbe\u5f69");
}
catch(e){
alert("\u60a8\u53ef\u4ee5\u5c1d\u8bd5\u901a\u8fc7\u5feb\u6377\u952e"+_4+" + D \u6dfb\u52a0\u4e66\u7b7e~");
}
}
};
})();
function $(s){
return document.getElementById(s);
}
function isCapsLockOn(e){
var c=e.keyCode||e.which;
var s=e.shiftKey;
if(((c>=65&&c<=90)&&!s)||((c>=97&&c<=122)&&s)){
return true;
}
return false;
}
function showMsg(s){
var el=$("errorMessage");
if(!el){
return;
}
el.style.display="block";
el.innerHTML=s;
}
function hideMsg(){
if($("errorMessage")){
$("errorMessage").style.display="none";
}
}
function showCapsLockMsg(s){
var el=$("capsLockMessage");
if(!el){
return;
}
el.style.display="block";
}
function hideCapsLockMsg(){
if($("capsLockMessage")){
$("capsLockMessage").style.display="none";
}
}
$("loginForm").onsubmit=function(){
function isEmail(_d){
var _e="";
_d=_d.replace(/^\s+|\s+$/g,"");
for(var i=0,j=_d.length;i<j;i++){
var _11=_d.charCodeAt(i);
if(_11>=65281&&_11<=65373){
_e+=String.fromCharCode(_11-65248);
}else{
_e+=String.fromCharCode(_11);
}
}
_e=_e.replace(/·/,"@");
$("email").value=_e=_e.replace(/[。|,|，|、]/g,".");
return /^[A-Z_a-z0-9-\.]+@([A-Z_a-z0-9-]+\.)+[a-z0-9A-Z]{2,4}$/.test(_e);
}
if(/^\s*$/.test($("password").value)){
showMsg("\u60a8\u8fd8\u6ca1\u6709\u586b\u5199\u5bc6\u7801");
$("password").focus();
return false;
}
if(/@/.test($("email").value)){
if(!isEmail($("email").value)){
showMsg("E-mail\u683c\u5f0f\u9519\u8bef");
$("email").focus();
return false;
}
}else{
if(!/^[\w@_.-]{3,50}$/.test($("email").value)){
showMsg("\u5e10\u53f7\u683c\u5f0f\u9519\u8bef");
$("email").focus();
return false;
}
}
try{
var pwd=$("password").value;
$("password").value=hex_md5(pwd);
if(XN.browser.IE){
var _13=$element("<input name=\"enpassword\" value=\"true\" type=\"hidden\"/>");
}else{
var _13=$element("input");
_13.name="enpassword";
_13.value="true";
_13.type="hidden";
}
var _14=$("password").form;
$(_14).appendChild(_13);
}
catch(e){
$("password").value=pwd;
}
return true;
};
$("password").onkeypress=function(e){
if(isCapsLockOn(e||window.event)){
showCapsLockMsg("\u5927\u5199\u9501\u5b9a\u5f00\u542f");
}else{
hideCapsLockMsg();
}
};
XN.dom.ready(function(){
var em=$("email");
if(em.value==""){
$("email").focus();
}else{
$("password").focus();
}
});

